package Weapons;

import org.newdawn.slick.geom.Vector2f;
import game.Config.BulletFactory;
/**
 * This class represents a pistol in the game. Pistol extends weapon
 * and thus can fire bullets. 
 * The pistol will always fire bullets in a straight line when it fires.
 * @author Sebastian Isheden and Victor Beer
 *
 */
public class Pistol extends Weapon {
	/**
	 * Creates a Pistol with given parameters.
	 * @param fireRate	The amount of times this weapon can fire per second.
	 * @param damage  The damage per shot of this weapon.
	 * @param bulletSpeed  The speed the fired bullets will traverse the screen.
	 */
	public Pistol(float fireRate, float damage, float bulletSpeed) {
		super(fireRate, damage, bulletSpeed);
	}

	@Override
	protected void spawnBullet(Vector2f position, Vector2f direction) {
		callFactory(position,direction);
	}

	/**
	 * @return A copy of this pistol.
	 */
	@Override
	public Weapon copy() {
		return new Pistol(1/this.fireInterval,this.damage,this.bulletSpeed);
	}

	@Override
	protected void callFactory(Vector2f position, Vector2f direction) {
		BulletFactory.createStandardBullet(this.damage,this.bulletSpeed,position, direction);
	}

}
